package kuangjia;

import java.util.ArrayList;
import java.util.List;

public class New2 {
    public static void main(String[] args) {
        New1 th=new New1(1,"火山爆发","weref");
        New1 th1=new New1(2,"火山爆发4","weref1");
        New1 th2=new New1(3,"火山爆发5","weref2");
        New1 th3=new New1(4,"火山爆发6","weref3");
        List list=new ArrayList();
        list.add(th);
        list.add(th1);
        list.add(th2);
        list.add(th3);
        //获取长度
      int num=  list.size();
      for(int i=0;i< list.size();i++){
          if(list.get(i)!=null){
              //类型强制转换
              New1 te=(New1) list.get(i);
System.out.println("新闻的id"+te.getId());
System.out.println("新闻的标题"+te.getNewName());
              System.out.println("新闻的作者"+te.getUserNname());


          }

      }



    }
}
